import { defineStore } from "pinia"

const useUserInfoStore = defineStore('userInfo', {
    // defineStore('userInfo',{})  userInfo就是这个仓库的名称name
    state: () => ({
        accounts: [
            {id:1,
                account: "24208090326",
                password: "123456",
                userName: "cck",
                userImg:"/src/assets/defaultPic.jpg",
                info:"爷的帅不值一提！！！"
            },
            {id:2,
                account: "24208090327",
                password: "123456",
                userName: "cck2",
                userImg:"/src/assets/defaultPic.jpg",
                info:"爷的帅更不值一提！！！"
            }
        ],
        carList:[
            {id:1,
                userId:1,
                url:"/src/assets/goodsImg01.png",
                price:654,
                info:"北京同仁堂甲状腺结节消散结贴专用消除甲亢脖子粗4a甲减消肿膏",
                num:10,
                flag:false
            },
            {id:2,
                userId:2,
                url:"/src/assets/goodsImg01.png",
                price:2,
                info:"北京同仁堂甲状腺结节消散结贴专用消除甲亢脖子粗56甲减消肿膏",
                num:10,
                flag:false
            }
        ],
        userInfo:{
            userId:0,
            userName:"",
            userImg:"",
            info:"",
            flag:false,
            shopCars:[]
        }
    }),
    persist: {
        key: 'piniaStore', //存储名称
        storage: sessionStorage, // 存储方式
        paths: ['accounts','userInfo','carList']
    }
})

export default useUserInfoStore